package com.kqb.sgcommon.base.utils;

/**
 * @author 杉果树皮
 */
public class ThrowUtils {

    /**
     * 条件成立抛异常
     *
     * @param condition
     * @param runtimeException
     */
    public static void throwIf(boolean condition, RuntimeException runtimeException) {
        if (condition) {
            throw runtimeException;
        }
    }

    /**
     * 条件不成立抛异常
     *
     * @param condition
     * @param runtimeException
     */
    public static void throwNotIf(boolean condition, RuntimeException runtimeException) {
        throwIf(!condition, runtimeException);
    }
}
